package com.yl.rabbitmq.day07;

import com.rabbitmq.client.Channel;
import com.yl.rabbitmq.utils.RabbitMQUtil;

import java.util.Scanner;

/**
 * @author yangl
 */
public class DirectLogs {
    /**
     * 交换机的名称
     */
    public static final String EXCHANGE_NAME = "direct_logs";

    public static void main(String[] args) throws Exception{
        Channel channel = RabbitMQUtil.getChannel();
        //声明交换机
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String message = scanner.next();
            channel.basicPublish(EXCHANGE_NAME, "error", null, message.getBytes("UTF-8"));
            System.out.println("生产者发出消息：" + message);
        }

    }
}
